package com.example.template.core.dao;

import com.example.template.core.dao.provider.MyInsertProvider;
import org.apache.ibatis.annotations.InsertProvider;
import tk.mybatis.mapper.annotation.RegisterMapper;
import tk.mybatis.mapper.common.Mapper;
import tk.mybatis.mapper.common.special.InsertListMapper;

import java.util.List;

/**
 * @ClassName CommonMapper
 * @Description TODO 自定义通用Mapper
 * @Date 2019/4/27 17:04
 **/
@RegisterMapper
public interface CommonMapper<T> extends
        Mapper<T>,
        InsertListMapper<T> {
    /**
     * 保存实体List，null的属性也会保存，不会使用数据库默认值
     *
     * @param recordList
     * @return
     */
    @InsertProvider(type = MyInsertProvider.class, method = "dynamicSQL")
    int myInsertList(List<? extends T> recordList);
}
